﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BIZMA
{
    public partial class Web : System.Web.UI.MasterPage
    {
        public bool Fullpage { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {


            if (!IsPostBack)
            {
                List<BIZModel.Navigation> navList = new List<BIZModel.Navigation>();

                BIZModel.Navigation nav = new BIZModel.Navigation();

                Guid parent = Guid.NewGuid();
                Guid selectedId = parent;

                nav.NodeId = parent;
                nav.NodeLevel = 0;
                nav.NodeName = "BIZMA";
                nav.NodePath = "BIZMA";
                nav.NodeNavUrl = ResolveUrl("~/default.aspx");
                nav.NodeParentId = null;
                navList.Add(nav);

                nav = new BIZModel.Navigation();
                nav.NodeId = Guid.NewGuid(); ;
                nav.NodeLevel = 1;
                nav.NodeName = "Projekt";
                nav.NodePath = "BIZMA/Projekt";
                nav.NodeNavUrl = ResolveUrl("~/Site/Project/default.aspx");
                nav.NodeParentId = parent;
                if (Request.Url.AbsolutePath.Contains("Site/Project/default.aspx"))
                    selectedId = nav.NodeId;
                navList.Add(nav);


                nav = new BIZModel.Navigation();
                nav.NodeId = Guid.NewGuid(); ;
                nav.NodeLevel = 1;
                nav.NodeName = "Kunder";
                nav.NodePath = "BIZMA/Kunder";
                nav.NodeNavUrl = ResolveUrl("~/Site/Customer/default.aspx");
                nav.NodeParentId = parent;
                if (Request.Url.AbsolutePath.Contains("Site/Customer/default.aspx"))
                    selectedId = nav.NodeId;
                navList.Add(nav);


                nmTop.LoadMenu(navList, selectedId);
            }

            if (Fullpage)
            {
                mainDiv.Attributes["class"] = "twelve columns";
                rightDiv.Visible = false;
            }
            else
            {
                mainDiv.Attributes["class"] = "nine columns";
                rightDiv.Visible = true;
            }
        }
    }
}